import Vue from 'vue'
import Router from 'vue-router'
import Home from '@/views/home/home'
import Recommend from '@/views/recommend/recommend'
import RankingList from '@/views/rankingList/rankingList'
import Song from '@/views/song/song'

import User from '@/views/user/user'
Vue.use(Router)

  const routes = [
    {
      path: '/',
      redirect: '/home'
    },
    {
      path: '/home',
      component: Home,
      redirect: '/home/recommend',
      children:[
        {
          path: '/home/recommend',
          component: Recommend,
          meta: {
            keepAlive: true
          }
        },
        {
          path: '/home/rankingList',
          component: RankingList,
          meta: {
            keepAlive: true
          }
        },
        {
          path: '/home/song',
          component: Song,
          meta: {
            keepAlive: true
          }
        },
      ]
    },
    {
      path: '/user',
      name: 'user',
      component: User
    }
  ]

export default new Router({
  mode:'history',
  linkActiveClass: 'active',
  linkExactActiveClass: 'active',
  routes,
})
